﻿/**************************************************************
 * Copyright Eastmoney Corporation. All rights reserved.
 * 
 * Author: guitao(guitao@eastmoney.com) 
 * Create Date: 2020/6/12 13:36:44
 * Description:
 *          
 * Revision History:
 *      Date         Author               Description
 *              
***************************************************************/

using gt.EventBus.Events;
using System;
using System.Collections.Generic;
using System.Text;

namespace gt.EventBus.Abstractions
{
    /// <summary>
    /// 事件订阅Manager
    /// 相比较IEventBus提供更丰富底层的方法，可用IEventBus依赖
    /// </summary>
    public interface IEventBusSubscriptionsManager
    {
        bool IsEmpty { get; }
        event EventHandler<string> OnEventRemoved;
        void AddSubscription<T, TH>()
           where T : IntegrationEvent
           where TH : IIntegrationEventHandler<T>;
        void RemoveSubscription<T, TH>()
             where TH : IIntegrationEventHandler<T>
             where T : IntegrationEvent;
        bool HasSubscriptionsForEvent<T>() where T : IntegrationEvent;
        bool HasSubscriptionsForEvent(string eventName);
        Type GetEventByName(string eventName);
        void Clear();
        IEnumerable<Type> GetHandlersForEvent(string eventName);
        IEnumerable<Type> GetHandlersForEvent<T>()
            where T : IntegrationEvent;
        string GetEventKey<T>();
    }
}
